clear
clc

% Define temperature range from -100 to 500 degrees Celsius
T = -80:1:550;
% S = round(linspace(3200, 4300, length(T)));
% Convert temperature to Kelvin

T_K = T + 273.15;

% Cp(1) = refpropm('C','T',T_K(1),'S', S(1),'AIR.MIX')

for ii = 1:length(T)
    % try
        Cp(ii) = refpropm('C','T',T_K(ii),'P', 101,'AIR.MIX');
    % catch
    %     Cp(ii) = Cp(ii-1);
    % end

    try
        Cv(ii) = refpropm('O','T',T_K(ii),'P', 101,'AIR.MIX');
    catch
        Cv(ii) = Cv(ii-1);
    end
end

% Plot the specific heat capacity as a function of temperature
figure;
plot(T, Cp./Cv)
xlabel('Temperature (°C)');

grid on;

%%

clear
clc
close all

% Hexane

T = -80:1:0;
T_K = T + 273.15;

% for ii = 1:length(T)
%     Cp(ii) = refpropm('C','T',T_K(ii),'P', 101,'HEXANE.FLD');
%     Cv(ii) = refpropm('O','T',T_K(ii),'P', 101,'HEXANE.FLD');
% end

% figure;
% hold off;
% plot(T, Cp)
% hold on;
% plot(T, Cv)
% xlabel('Temperature (°C)');
% grid on;

for ii = 1:length(T)
    DD(ii) = refpropm('D','T',T_K(ii),'P', 101,'HEXANE.FLD'); 
end

polyfit(T_K, DD, 1)

%%

clc
clear

a=9;

for ii = 1:100
    a = a +1;
    if a>=100
        break;
    end
end


